package cn.demoncat.util.lang.entity;

import java.io.Serializable;
import java.util.Objects;

/**
 * 描述：{id,name}键值对类型的实体类
 *
 * @author yxl
 *
 * @version 2.0
 *
 * @since 2016-12-9
 */
public class IdName implements Serializable{
 
	private static final long serialVersionUID = -8826907311034515157L;

	private Long id;
	private String name;
	
	public IdName() {
		super();
	}
	public IdName(Long id, String name) {
		super();
		this.id = id;
		this.name = name;
	}

	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}

	@Override
	public String toString() {
		return "IdName [id=" + id + ", name=" + name + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) return true;
		if (o == null || getClass() != o.getClass()) return false;
		IdName idName = (IdName) o;
		return Objects.equals(id, idName.id) && Objects.equals(name, idName.name);
	}
}
